package com.yc.cloud.admin.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 告警记录上传请求DTO（文件上传版，用于Postman测试）
 *
 * @author kinggu
 * @since 2025-11-06
 */
@Data
@Schema(description = "告警记录上传请求（文件上传版）")
public class AlarmRecordUploadFileReqDTO {

    @NotNull(message = "图片文件不能为空")
    @Schema(description = "告警图片文件", requiredMode = Schema.RequiredMode.REQUIRED)
    private MultipartFile imageFile;

    @NotBlank(message = "设备SN不能为空")
    @Schema(description = "设备序列号", example = "DEVICE001", requiredMode = Schema.RequiredMode.REQUIRED)
    private String deviceSn;

    @NotNull(message = "告警类型不能为空")
    @Schema(description = "告警类型（算法ID）", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long alarmType;

    @Schema(description = "摄像头ID（可选，如不提供则自动查询设备绑定的摄像头）", example = "1")
    private Long cameraId;

    @Schema(description = "检测位置信息列表（可选，场景检测类型可不提供）")
    private List<DetectionPositionDTO> detectionPositions;

    /**
     * 检测位置DTO
     */
    @Data
    @Schema(description = "检测位置信息")
    public static class DetectionPositionDTO {
        @Schema(description = "检测框左上角X坐标", example = "100")
        private Integer x;

        @Schema(description = "检测框左上角Y坐标", example = "100")
        private Integer y;

        @Schema(description = "检测框宽度", example = "200")
        private Integer width;

        @Schema(description = "检测框高度", example = "200")
        private Integer height;

        @Schema(description = "目标类型/标签", example = "person")
        private String targetType;

        @Schema(description = "检测置信度（0-1）", example = "0.95")
        private Float confidence;
    }
}

